package Models

import (
	"hyper/supports/models"
)

type Menu struct {
	models.BaseModel

	Pid  uint64 `gorm:"column:pid;default:0;comment:菜单关系id" json:"pid,omitempty"`
	Name string `gorm:"column:name;type:varchar(255);not null;comment:菜单名称" json:"name,omitempty"`

	// Icon       string `gorm:"type:varchar(255);null;comment:图标" json:"icon,omitempty"`
	// Controller string `gorm:"type:varchar(255);null;comment:控制器名称" json:"controller,omitempty"`
	// Slug       string `gorm:"type:varchar(255);index;null;comment:菜单对应的权限" json:"slug,omitempty"`
	// Url string `gorm:"column:url;type:varchar(255);not null;comment:菜单链接地址" json:"url,omitempty"`
	// Active string `gorm:"type:varchar(255);comment:菜单高亮地址" json:"active,omitempty"`
	WebId uint64 `gorm:"column:web_id;index;default:0;comment:前端id" json:"web_id,omitempty"`

	// Description string `gorm:"column:description;type:varchar(255);not null;comment:菜单描述" json:"description,omitempty"`
	Sort   int8 `gorm:"column:sort;type:uint;default:0;comment:排序" json:"sort,omitempty"`
	IsShow int8 `gorm:"column:is_show;type:uint;default:1;comment:是否展示：0、否；1、是" json:"is_show,omitempty"`
	// ActiveModel string `gorm:"column:active_model;type:text;null;" json:"active_model,omitempty"`

	models.CommonTimestampsField
	models.DeletedAtTimestampsField
}

type MenuList struct {
	ID    uint64 `json:"id,omitempty"`
	Name  string `json:"name,omitempty"`
	Pid   uint64 `json:"pid"`
	WebId uint64 `json:"web_id"`

	Children []MenuList `gorm:"foreignKey:Pid" json:"children"`
}
